<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>收集夹导入</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css"  media="all" />
</head>
<body>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px; text-align: center;">
    <legend>收集夹导入</legend>
</fieldset>

<input type="file" name="bookMark" id="bookMark" lay-type="file" class="layui-upload-file"/>

<script src="/static/plugins/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use('upload', function () {
        var index;
        layui.upload({
            url: '/user/collect/import'
            , elem: '#bookMark' //指定原始元素，默认直接查找class="layui-upload-file"
            , method: 'post' //上传接口的http类型
            , before:function () {
                index = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
            }
            , success: function (res) {
                layer.close(index);
                if (res.code === 0) {
                    layer.msg('导入成功');
                }else{
                    layer.msg(res.msg);
                }
            }
        });
    });
</script>

</body>
</html>